package xmla

import(
	"bytes"
	"strings"
)

type XMLAExecuteProperties struct{
	DataSourceInfo string
	Catalog string
	Format string
	Content string
	AxisFormat string
}
func (p *XMLAExecuteProperties) getPropertyListXML(indent string)(string){
	var buffer bytes.Buffer
	buffer.WriteString("\n")
	buffer.WriteString(indent)
	buffer.WriteString("<Properties>")
	buffer.WriteString("\n")
	buffer.WriteString(indent)
	buffer.WriteString("<PropertyList>")
	dsi_trim:=strings.TrimSpace(p.DataSourceInfo)
	if len(dsi_trim)>0{
		buffer.WriteString("\n")
		buffer.WriteString(indent)
		buffer.WriteString(elementIndent)
		buffer.WriteString("<DataSourceInfo>")
		buffer.WriteString(dsi_trim)
		buffer.WriteString("</DataSourceInfo>")
	}
	cat_trim:=strings.TrimSpace(p.Catalog)
	if len(cat_trim)>0{
		buffer.WriteString("\n")
		buffer.WriteString(indent)
		buffer.WriteString(elementIndent)
		buffer.WriteString("<Catalog>")
		buffer.WriteString(cat_trim)
		buffer.WriteString("</Catalog>")
	}
	for_trim:=strings.TrimSpace(p.Format)
	if len(for_trim)>0{
		buffer.WriteString("\n")
		buffer.WriteString(indent)
		buffer.WriteString(elementIndent)
		buffer.WriteString("<Format>")
		buffer.WriteString(for_trim)
		buffer.WriteString("</Format>")
	}
	con_trim:=strings.TrimSpace(p.Content)
	if len(con_trim)>0{
		buffer.WriteString("\n")
		buffer.WriteString(indent)
		buffer.WriteString(elementIndent)
		buffer.WriteString("<Content>")
		buffer.WriteString(con_trim)
		buffer.WriteString("</Content>")
	}
	aix_trim:=strings.TrimSpace(p.AxisFormat)
	if len(aix_trim)>0{
		buffer.WriteString("\n")
		buffer.WriteString(indent)
		buffer.WriteString(elementIndent)
		buffer.WriteString("<AxisFormat>")
		buffer.WriteString(aix_trim)
		buffer.WriteString("</AxisFormat>")
	}
	buffer.WriteString("\n")
	buffer.WriteString(indent)
	buffer.WriteString("</PropertyList>")
	buffer.WriteString("\n")
	buffer.WriteString(indent)
	buffer.WriteString("</Properties>")
	return buffer.String()
}